//
//  ZWJieTu.m
//  MyTest
//
//  Created by rayootech on 15/9/26.
//  Copyright (c) 2015年 rayootech. All rights reserved.
//

#import "UIImage+ZWJieTu.h"

@implementation UIImage (ZWJieTu)

+ (instancetype)captureWithView:(UIView *)view{
   //1、开启上下文
    UIGraphicsBeginImageContextWithOptions(view.frame.size, NO, 0.0);
    
    //2、将控制器view的layer渲染到上下文
    [view.layer renderInContext:UIGraphicsGetCurrentContext()];
    
    //3、取出图片
    UIImage *newImage=UIGraphicsGetImageFromCurrentImageContext();
    
    //4、结束上下文
    UIGraphicsEndImageContext();
    
    return newImage;

}

@end
